# # 导入加密库
# import hashlib
# from utils.captcha.captcha import captcha
# from rest_framework.response import Response
#
# # 加密方法
# def make_password(mypass):
#     # md5算法
#     mypass = hashlib.md5()
#     # 对字符串进行编译
#     mypass.update('456'.encode(encoding='utf-8'))
#     # 返回密文
#     return mypass.hexdigest()
#
# print(make_password('123456'))
#
# def generate_code():
#     name, text, image_url = captcha.generate_captcha()
#     print('文本：', text)
#     print('图片', image_url)
#     res = {}
#     res['code'] = text
#     res['make_response'] = image_url
#     res['Content-Type'] = 'image/jpg'
#     return Response(res)
# print()

# 测试redis
import redis
# 建立连接
r = redis.Redis('localhost')
r.set('mykey','test')

mycode = r.get('mykey')
# 转码
mycode = mycode.decode('utf-8')
print(mycode)